package com.cjc.service;

import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cjc.domain.User;
import com.cjc.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 陈江灿
 * @CreateTime: 2025-01-21
 */
@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    /**
     * 获取用户详情
     * @param id
     * @return
     */
    public User getUserById(Long id) {
        return userMapper.selectById(id);
    }

    /**
     * 登录
     * @return
     */
    public User login(User user) {
        return userMapper.selectOne(new QueryWrapper<User>().eq("user_name", user.getUserName()).eq("password", user.getPassword()));
    }
}
